// SerialDlg.h : header file
//
#include "ContentsView.h"	// Added by ClassView
#include "comm.h"
	// Added by ClassView
#include "ContentsView.h"

#if !defined(AFX_SERIALDLG_H__2BB175F8_C276_4263_82E6_5F184C95B9E0__INCLUDED_)
#define AFX_SERIALDLG_H__2BB175F8_C276_4263_82E6_5F184C95B9E0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000



/////////////////////////////////////////////////////////////////////////////
// CSerialDlg dialog


	

class CSerialDlg : public CDialog
{
// Construction
public:
	int k;
	CContentsView *m_pView;
	CCreateContext m_context;

//	BOOL StartRec;


	void SaveSettings(void);
	
	int m_nSettingStop;
	CSerialDlg(CWnd* pParent = NULL);	// standard constructor

	TTYSTRUCT CSerialDlg::Int2TTY()
	{
		TTYSTRUCT tty;
		ZERO_MEMORY(tty);

		tty.byCommPort = (BYTE)m_nSettingPort+1;
		tty.byXonXoff = FALSE;
		tty.byByteSize = (BYTE)_nDataValues[m_nSettingData];
		tty.byFlowCtrl = (BYTE)_nFlow[m_nSettingFlow];
		tty.byParity   = (BYTE)m_nSettingParity;
		tty.byStopBits = (BYTE)_nStopBits[m_nSettingStop];
		tty.dwBaudRate = (DWORD)_nBaudRates[m_nSettingBaud];

		return tty;

	}
	TTYSTRUCT CSerialDlg::LoadSettings()
	{
		CWinApp *pApp = AfxGetApp();

		m_nSettingPort = pApp->GetProfileInt(CS_REGKEY_SETTINGS, CS_REGENTRY_PORT, 1);
		m_nSettingParity = 0;
		m_nSettingBaud = pApp->GetProfileInt(CS_REGKEY_SETTINGS, CS_REGENTRY_BAUD, 1);
		m_nSettingData = 1;
		m_nSettingStop = 0;
		m_nSettingFlow = 0;

		return Int2TTY();
	}
// Dialog Data
	//{{AFX_DATA(CSerialDlg)
	enum { IDD = IDD_SERIAL_DIALOG };
	int		m_nSettingBaud;
	int		m_nSettingPort;
	int		m_nSettingData;
	int		m_nSettingParity;
	int		m_nSettingFlow;
	CString	m_EditData;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSerialDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;
	CComm m_Comm;

	// Generated message map functions
	//{{AFX_MSG(CSerialDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnCheckComm();
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnRest();
	afx_msg void OnChangeEdit1();
	afx_msg void OnStartRecoding();
	afx_msg void OnEndRecoding();
	afx_msg void OnDrawRecoding();
	afx_msg void OnOutputDot();
	afx_msg void OnOutputLine();
	afx_msg void OnResetRecoding();
	afx_msg void OnDataGogo();
	
	//}}AFX_MSG
	afx_msg LONG OnReceiveData(UINT,LONG);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SERIALDLG_H__2BB175F8_C276_4263_82E6_5F184C95B9E0__INCLUDED_)
